---
title: Consumption
summary: How a consuming application references, constructs, calls, and disposes the proxy.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-09-22
---

# Consumption

`FaxService.SendFax` constructs a `FaxServiceProxy` per invocation, which in turn builds a code-configured `BasicHttpBinding` and endpoint address, constructs the generated `FaxServiceSoapClient` directly, and invokes `Send` once per recipient synchronously.

## Reference style

| Field | Value |
| --- | --- |
| Mechanism | Service Reference (svcutil / Add Service Reference) |
| Declared in | `src\WCF\SAIF.Services.WCF.Host\WCF.csproj` |
| Generated artifacts | `src\WCF\SAIF.Services.WCF.Host\Service References\Legacy.Fax\Reference.cs` |
| Target framework | .NET Framework 4.x |
| Regeneration command | Visual Studio "Update Service Reference" |

No hand edit was found inside the generated `Reference.cs`; a refresh carries no known loss*.

## Construction

```csharp
var binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly);
binding.MaxReceivedMessageSize = int.MaxValue;
binding.MaxBufferSize = int.MaxValue;
binding.ReaderQuotas.MaxArrayLength = int.MaxValue;
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;
webService = new FaxServiceSoapClient(binding, new EndpointAddress(serviceUrl));
```

| Step | Requirement |
| --- | --- |
| Endpoint address | Obtained from the environment configuration service via `EnvironmentConfigKeys.FaxSoapServiceUrl` — see [Endpoint resolution](architecture.md#endpoint-resolution) |
| Binding | Constructed in code |
| Credentials | Windows transport credential (`HttpClientCredentialType.Windows`) — no credential value is supplied in code or configuration |
| Initialization | Single-constructor; no follow-up property assignment |

## Endpoint configuration

| Setting | Value | Source | Changeable without a rebuild |
| --- | --- | --- | --- |
| Endpoint address | Resolved from the environment configuration service — see [Endpoint resolution](architecture.md#endpoint-resolution) | `src\WCF\SAIF.Services.WCF.Host\Services\FaxService.cs:21-25` | Yes — resolved per request from the environment service* |
| Binding configuration | Constructed in code | `src\WCF\SAIF.Services.WCF.Host\Services\LegacyProxies\FaxServiceProxy.cs:17` | No |
| Security mode | `BasicHttpSecurityMode.TransportCredentialOnly` | `src\WCF\SAIF.Services.WCF.Host\Services\LegacyProxies\FaxServiceProxy.cs:17` | No |

The configured `<system.serviceModel><client><endpoint>` in `Web.config`/`Web.Base.config` is not consulted by this construction path at all; see [Endpoint resolution](architecture.md#endpoint-resolution) for the full finding.

## Resilience

| Concern | Finding | Configurable by consumer | Source | Tech debt |
| --- | --- | --- | --- | --- |
| Timeout | None configured — binding defaults apply | No | `src\WCF\SAIF.Services.WCF.Host\Services\LegacyProxies\FaxServiceProxy.cs:17-27` | Yes |
| Retry | None configured | No | — | Yes |
| Circuit breaking | None configured | No | — | Yes |
| Thread safety | Not determined from source | — | `src\WCF\SAIF.Services.WCF.Host\Services\LegacyProxies\FaxServiceProxy.cs` | No |
| Cancellation | Not supported — no cancellation token on any call site | — | `src\WCF\SAIF.Services.WCF.Host\Services\LegacyProxies\FaxServiceProxy.cs:41` | Yes |
| Message size limits | `MaxReceivedMessageSize`/`MaxBufferSize`/`ReaderQuotas.MaxArrayLength` all `int.MaxValue` | No | `src\WCF\SAIF.Services.WCF.Host\Services\LegacyProxies\FaxServiceProxy.cs:19-24` | Yes |

No retry policy exists at either call site, so any transient failure of the remote service surfaces directly to the caller of the hosted `FaxService.SendFax` operation, which itself has no try/catch around the call and no compensating cleanup for a fax already partially sent to earlier recipients. No timeout is set on the code-constructed binding or on the unreferenced configured binding, so a hung call blocks on the transport default rather than a stated intent — see [Tech debt](tech-debt.md). The message-size quotas set to `int.MaxValue` remove the guard that limits how large a response the process will accept, also raised in [Tech debt](tech-debt.md).

## Disposal

| Aspect | Finding |
| --- | --- |
| Disposal performed | `Close()` only |
| Faulted channel handled | No — a faulted channel throws from `Close()`, masking the original failure* |
| Wrapper responsibility | `FaxServiceProxy.Dispose(bool)` disposes the proxy |
| Source | `src\WCF\SAIF.Services.WCF.Host\Services\LegacyProxies\FaxServiceProxy.cs:55-63` |

```csharp
protected virtual void Dispose(bool disposing)
{
    if (disposing)
    {
        webService.Close();
    }
}
```

## Error handling for consumers

| Failure | Surfaces as | Consumer action |
| --- | --- | --- |
| Service unreachable | `CommunicationException` | Not handled — propagates unchanged to the hosted `FaxService.SendFax` operation, and from there to the service-wide `[LogErrorBehavior]` handler |
| SOAP fault returned | `FaultException` / `FaultException<T>` | Not handled — propagates unchanged |
| Timeout exceeded | `TimeoutException` | Not handled — propagates unchanged |
| Response larger than the message size limit | Not applicable — quotas are set to `int.MaxValue`, so this guard does not trigger | — |
| Empty or absent output message | No exception — `Send` returns `void` and `SendResponse` carries no body | The caller captures nothing and cannot distinguish a partially delivered fax |

## Usage examples

```csharp
// Called once per recipient from FaxService.SendFax
faxServiceProxy.SendFax(recipient, fullFilePath);
```

| Scenario | Operations used | Notes |
| --- | --- | --- |
| Hosted `FaxService.SendFax` fans out to N recipients | `Send` | Invoked once per `FaxRecipient` in `config.Recipients`; the `foreach` aborts on the first failure |

## Lifecycle guidance

| Question | Answer |
| --- | --- |
| Construct once or per call | `FaxServiceProxy` is constructed once per `FaxService` instance and held in a `readonly` field; the underlying `FaxServiceSoapClient` is constructed once per `FaxServiceProxy` instance |
| Disposable | Yes (`IDisposable`) |
| Safe to share across threads | Not determined from source |

## Related documentation
- [Client index](index.md)
- [Overview](overview.md)
- [Architecture](architecture.md)
- [Contract](contract.md)
- [Operation map](operation-map.md)
- [Client reference](reference.md)
- [Dependencies](dependencies.md)
- [Tech debt](tech-debt.md)

> **Note:** Statements marked with `*` were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.

## Sources
- `src\WCF\SAIF.Services.WCF.Host\Services\LegacyProxies\FaxServiceProxy.cs`
- `src\WCF\SAIF.Services.WCF.Host\Services\FaxService.cs`
- `src\WCF\SAIF.Services.WCF.Host\Extensions\ErrorLogErrorHandler.cs`
- `src\WCF\SAIF.Services.WCF.Host\Web.config`
